﻿<UserControl x:Class="Markup.Programming.Silverlight.Sandbox.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:p="http://markupprogramming.codeplex.com/markup/programming"
    Width="300" Height="300">
    <UserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:p="http://markupprogramming.codeplex.com/markup/programming"
    Height="300" Width="300">
        <Grid Name="LayoutRoot">
            <Grid.Resources>
                <p:ResourceObject x:Key="ViewModel">
                    <p:Property PropertyName="ControlPoints">
                        <p:Collection>
                            <p:Path>[] { X = 50., Y = 50. }</p:Path>
                            <p:Path>[] { X = 100., Y = 100. }</p:Path>
                            <p:Path>[] { X = 50., Y = 150. }</p:Path>
                        </p:Collection>
                    </p:Property>
                    <p:Property PropertyName="Segments">
                        <p:Collection>
                            <p:Path>[] { Start = @this.ControlPoints[0], End = @this.ControlPoints[1] }</p:Path>
                            <p:Path>[] { Start = @this.ControlPoints[1], End = @this.ControlPoints[2] }</p:Path>
                        </p:Collection>
                    </p:Property>
                </p:ResourceObject>
            </Grid.Resources>
            <Grid.DataContext>
                <Binding Path="Value" Source="{StaticResource ViewModel}"/>
            </Grid.DataContext>
            <Grid.Background>
                <SolidColorBrush Color="AliceBlue"/>
            </Grid.Background>
            <StackPanel>
                <TextBlock FontSize="20" FontWeight="Bold">Segments</TextBlock>
                <ListBox ItemsSource="{Binding Segments}">
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal">
                                <TextBlock>/Start.X:</TextBlock>
                                <TextBlock Text="{Binding Start.X}"/>
                                <TextBlock>/Start.Y:</TextBlock>
                                <TextBlock Text="{Binding Start.Y}"/>
                                <TextBlock>/End.X:</TextBlock>
                                <TextBlock Text="{Binding End.X}"/>
                                <TextBlock>/End.Y:</TextBlock>
                                <TextBlock Text="{Binding End.Y}"/>
                            </StackPanel>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
                <TextBlock FontSize="20" FontWeight="Bold">Control Points</TextBlock>
                <ListBox ItemsSource="{Binding ControlPoints}">
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal">
                                <TextBlock>/X:</TextBlock>
                                <TextBlock Text="{Binding X}"/>
                                <TextBlock>/Y:</TextBlock>
                                <TextBlock Text="{Binding Y}"/>
                            </StackPanel>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
            </StackPanel>
        </Grid>
    </UserControl>
</UserControl>
